package com.liu.shopcar.config;

import com.liu.shopcar.interceptor.UserCarInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置过滤器过滤的范围
 */
@Configuration
public class WebMVCConfig implements WebMvcConfigurer {

    @Autowired
    private UserCarInterceptor userCarInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(userCarInterceptor).addPathPatterns("/**");
    }
}
